}
/* Skip past nine commas in ibuf to reach the dmy value */
- for (dmybuf=ibuf,i=0; i<9 && dmybuf != NULL; i++) {
+ for (dmybuf=ibuf,i=0; i<9; i++) {
dmybuf= strchr(dmybuf, ',');
+ if(dmybuf==NULL) {
+ /* If we run out of commas, the sentence is invalid. */
+ return;
+ }
dmybuf++;
}
had_checksum = 0;
return;
}
+
+ if(strstr(tbuf+1,"$")!=NULL)
+ {
+ /* If line has more than one $, there is probably an error in it. */
+ return;
+ }
/* @@@ zmarties: The parse routines all assume all fields are present, but
the NMEA format allows any field to be missed out if there is no data